<div class="bjui-pageContent">
    <form id="system-adminuser-edit-form" action="{{ url('admin/system/adminuser-update') }}" data-toggle="validate" method="post" data-close-current="true">
        <div class="bjui-row col-1" style="padding:20px;width:500px;">
            @if ( $ftype == 1 )
                <label class="row-label">角色：</label>
                <div class="row-input">
                    <select name="role_id" data-toggle="selectpicker" data-width="200">
                        @foreach ($role_list as $val)
                            @if ( $val->id == $role_id )
                                <option selected value="{{$val->id}}">{{$val->display_name}}</option>
                            @else
                                <option value="{{$val->id}}">{{$val->display_name}}</option>
                            @endif
                        @endforeach
                    </select>
                </div>
            @elseif ( $ftype == 2 )
                <label class="row-label">角色：</label>
                <div class="row-input">
                    @foreach ($role_list as $val)
                        @if ( $val['id'] == $role_id )
                            <input type="hidden" name="role_id" value="{{$val->id}}">
                            {{$val->display_name}}
                        @endif
                    @endforeach
                </div>
            @else

            @endif
            <input type="hidden" name="company_id" value="{{$company_id}}">
            @if ( !empty($info) )
                <input type="hidden" name="id" value="{{$info['id']}}">
                <label class="row-label">登陆账号：</label>
                <div class="row-input">
                    <input type="text" name="username" value="{{$info['username']}}">
                </div>
                <label class="row-label">旧密码：</label>
                <div class="row-input">
                    <input type="text" id="system_adminuser_edit_old_password" name="old_password" value="">
                </div>
            @else
                <input type="hidden" name="id" value="0">
                <label class="row-label">登陆账号：</label>
                <div class="row-input">
                    <input type="text" name="username" value="">
                </div>
            @endif
            <label class="row-label">密码：</label>
            <div class="row-input required">
                <input type="password" id="system_adminuser_edit_password" name="password" value="" data-rule="新密码:required;length(6~)">
            </div>
            <label class="row-label">确认密码：</label>
            <div class="row-input required">
                <input type="password" id="system_adminuser_edit_password2" name="password2" value="" data-rule="required;match(#system_adminuser_edit_password)">
            </div>
        </div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="check">确认修改</button></li>
    </ul>
</div>
<script>
    $(function () {
        $('#system-adminuser-edit-form').submit(function () {

            var system_adminuser_edit_old_password  = $('#system_adminuser_edit_old_password').val();
            if (system_adminuser_edit_old_password !== '') {
                var system_adminuser_edit_old_password_md5 = CryptoJS.MD5(system_adminuser_edit_old_password);
                $('#system_adminuser_edit_old_password').val(system_adminuser_edit_old_password_md5);
            }

            var system_adminuser_edit_password      = $('#system_adminuser_edit_password').val();
            var system_adminuser_edit_password2     = $('#system_adminuser_edit_password2').val();
            if (system_adminuser_edit_password !== '') {
                var system_adminuser_edit_password_md5 = CryptoJS.MD5(system_adminuser_edit_password);
                $('#system_adminuser_edit_password').val(system_adminuser_edit_password_md5);
            }
            if (system_adminuser_edit_password2 !== '') {
                var system_adminuser_edit_password2_md5 = CryptoJS.MD5(system_adminuser_edit_password2);
                $('#system_adminuser_edit_password2').val(system_adminuser_edit_password2_md5);
            }
        });
    });
</script>